package StudyCode.summary.Basic.mystring;

import java.nio.charset.Charset;
import java.util.Arrays;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class StringToByte {
	public static void main(String args[]){
		String str = "Hello World";
		byte[] bytes = str.getBytes();
		byte[] bytes1 = str.getBytes(Charset.forName("UTF-8"));
		System.out.println("方法1:");
		System.out.println(Arrays.toString(bytes));
		System.out.println("方法1:");
		System.out.println(Arrays.toString(bytes1));
	}
}
